/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is Forte for Java, Community Edition. The Initial
* Developer of the Original Code is Sun Microsystems, Inc. Portions
* Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.autoupdate;
/**
*
* @author phrebejk
* @version
*/
public class FirstPanel extends javax.swing.JPanel {
Wizard.Validator validator;
Settings settings = null;
static final long serialVersionUID =-3335860872113235775L;
/** Creates new form FirstPanel */
public FirstPanel( Wizard.Validator validator ) {
initComponents ();
settings = Settings.getShared();
this.validator = validator;
javax.swing.ButtonGroup bg = new javax.swing.ButtonGroup();
bg.add( webRadioButton );
bg.add( downloadRadioButton );
regnumTextField.setText( settings.getRegistrationNumber() );
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents () {//GEN-BEGIN:initComponents
jLabel1 = new javax.swing.JLabel ();
jTextArea1 = new javax.swing.JTextArea ();
webRadioButton = new javax.swing.JRadioButton ();
downloadRadioButton = new javax.swing.JRadioButton ();
jLabel2 = new javax.swing.JLabel ();
regnumTextField = new javax.swing.JTextField ();
proxyButton = new javax.swing.JButton ();
setLayout (new java.awt.GridBagLayout ());
java.awt.GridBagConstraints gridBagConstraints1;
setBorder (new javax.swing.border.EmptyBorder(new java.awt.Insets(8, 8, 8, 8)));
jLabel1.setText (java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("FirstPanel.welcomeLabel.text"));
jLabel1.setFont (new java.awt.Font ("Dialog", 1, 18));
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (24, 0, 40, 0);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints1.weightx = 1.0;
add (jLabel1, gridBagConstraints1);
jTextArea1.setLineWrap (true);
jTextArea1.setWrapStyleWord (true);
jTextArea1.setBackground ((java.awt.Color) javax.swing.UIManager.getDefaults ().get ("Button.background"));
jTextArea1.setText (java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("FirstPanel.jTextArea1.text"));
jTextArea1.setEditable (false);
jTextArea1.setFont (new java.awt.Font ("Dialog", 0, 12));
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints1.weightx = 1.0;
gridBagConstraints1.weighty = 1.0;
add (jTextArea1, gridBagConstraints1);
webRadioButton.setSelected (true);
webRadioButton.setText (java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("FirstPanel.webRadioButton.text"));
webRadioButton.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
wizardTypeChanged (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.insets = new java.awt.Insets (10, 0, 0, 0);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
add (webRadioButton, gridBagConstraints1);
downloadRadioButton.setText (java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("FirstPanel.downloadRadioButton.text"));
downloadRadioButton.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
wizardTypeChanged (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.insets = new java.awt.Insets (0, 0, 10, 0);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints1.weighty = 1.0;
add (downloadRadioButton, gridBagConstraints1);
jLabel2.setText (java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("FirstPanel.jLabel2.text"));
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (jLabel2, gridBagConstraints1);
regnumTextField.setColumns (15);
regnumTextField.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
regnumTextFieldActionPerformed (evt);
}
}
);
regnumTextField.addFocusListener (new java.awt.event.FocusAdapter () {
public void focusLost (java.awt.event.FocusEvent evt) {
regnumTextFieldFocusLost (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (0, 8, 0, 8);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints1.weightx = 1.0;
add (regnumTextField, gridBagConstraints1);
proxyButton.setText (java.util.ResourceBundle.getBundle("org/netbeans/modules/autoupdate/Bundle").getString("FirstPanel.jButton1.text"));
proxyButton.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
proxyButtonActionPerformed (evt);
}
}
);
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.gridheight = 2;
gridBagConstraints1.insets = new java.awt.Insets (0, 8, 0, 0);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.SOUTHEAST;
gridBagConstraints1.weighty = 1.0;
add (proxyButton, gridBagConstraints1);
}//GEN-END:initComponents
private void proxyButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_proxyButtonActionPerformed
ProxyDialog.showDialog();
}//GEN-LAST:event_proxyButtonActionPerformed
private void regnumTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_regnumTextFieldFocusLost
setRegNum();
}//GEN-LAST:event_regnumTextFieldFocusLost
private void regnumTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_regnumTextFieldActionPerformed
setRegNum();
}//GEN-LAST:event_regnumTextFieldActionPerformed
private void wizardTypeChanged (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_wizardTypeChanged
validator.setValid( true );
}//GEN-LAST:event_wizardTypeChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JRadioButton webRadioButton;
private javax.swing.JRadioButton downloadRadioButton;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField regnumTextField;
private javax.swing.JButton proxyButton;
// End of variables declaration//GEN-END:variables
/** Returns the type of wizard the user selected */
int getWizardType( ) {
if ( webRadioButton.isSelected() ) {
return 0;
}
else if ( downloadRadioButton.isSelected() ) {
return 1;
}
return 0;
}
/** Sets the registration number */
void setRegNum() {
settings.setRegistrationNumber( regnumTextField.getText() );
}
}
/*
* Log
* 8 Gandalf 1.7 1/25/00 Petr Hrebejk Shrinking of regnum
* field fixed
* 7 Gandalf 1.6 1/12/00 Petr Hrebejk i18n
* 6 Gandalf 1.5 1/9/00 Petr Hrebejk Proxy Config and
* Registration number added
* 5 Gandalf 1.4 11/27/99 Patrik Knakal
* 4 Gandalf 1.3 11/8/99 Petr Hrebejk Install of downloaded
* modules added, Licenses in XML
* 3 Gandalf 1.2 10/22/99 Ian Formanek NO SEMANTIC CHANGE - Sun
* Microsystems Copyright in File Comment
* 2 Gandalf 1.1 10/11/99 Petr Hrebejk Version before Beta 5
* 1 Gandalf 1.0 10/10/99 Petr Hrebejk
* $
*/